package com.eduction.service.impl;

import java.sql.SQLException;

import com.eduction.modules.system.dao.ApplyFileBaseDetailRepository;
import com.eduction.modules.system.dao.ApplyFileBaseRepository;
import com.eduction.modules.system.dao.ApplyFileBaseScoreRepository;
import com.eduction.modules.system.entity.ApplyFileBase;
import com.eduction.modules.system.entity.ApplyFileBaseDetail;
import com.eduction.modules.system.entity.ApplyFileBaseScore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eduction.modules.system.dao.ApplyFileRepository;
import com.eduction.modules.system.entity.ApplyFile;
import com.eduction.service.ApplyFileService;

@Service
public class ApplyFileServiceImpl implements ApplyFileService{

	@Autowired
	private ApplyFileRepository applyFileRepository;

	@Autowired
	private ApplyFileBaseRepository applyFileBaseRepository;
	@Autowired
	private ApplyFileBaseDetailRepository applyFileBaseDetailRepository;
	@Autowired
	private ApplyFileBaseScoreRepository applyFileBaseScoreRepository;

	
	@Override
	public ApplyFile queryApplyFileBySchoolId(String schoolId,String sonTargetId) throws SQLException {
		ApplyFile af = applyFileRepository.queryApplyFileBySchoolId(schoolId,sonTargetId);
		return af;
	}

	@Override
	public void saveAppplyFile(ApplyFile a) {
		applyFileRepository.saveAppplyFile(a);
	}

	/**
	 * 根据学校id查询自评表基础信息
	 * @param schoolId
	 * @return
	 */
	@Override
	public ApplyFileBase queryApplyFileBaseBySchoolId(String schoolId) throws SQLException{
		ApplyFileBase base=applyFileBaseRepository.queryApplyFileBaseBySchoolId(schoolId);
		return base;
	}

	/**
	 * 保存学校自评表基础信息
	 */
	@Override
	public void saveAppplyFileBase(ApplyFileBase a) throws SQLException {
		applyFileBaseRepository.saveAppplyFileBase(a);
	}

	/**
	 * 根据学校id查询自评表详细信息
	 * @param schoolId
	 * @return
	 */
	@Override
	public ApplyFileBaseDetail queryApplyFileBaseDetailBySchoolId(String schoolId) throws SQLException{
		ApplyFileBaseDetail base=applyFileBaseDetailRepository.queryApplyFileBaseDetailBySchoolId(schoolId);
		return base;
	}

	@Override
	public void saveAppplyFileBaseScore(ApplyFileBaseScore baseScore) throws SQLException {
		applyFileBaseScoreRepository.saveAppplyFileBaseScore(baseScore);
	}

	@Override
	public ApplyFileBaseScore queryApplyFileBaseScoreBySchoolId(String schoolId) throws SQLException {
		ApplyFileBaseScore base=applyFileBaseScoreRepository.queryApplyFileBaseScoreBySchoolId(schoolId);
		return base;
	}

	/**
	 * 保存学校自评表详细信息
	 */
	@Override
	public void saveAppplyFileBaseDetail(ApplyFileBaseDetail a) throws SQLException {
		applyFileBaseDetailRepository.saveAppplyFileBaseDetail(a);
	}

	@Override
	public void deleteApplyFile(String pId){
		applyFileRepository.deleteApplyFile(pId);
	}
}
